<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>出借人管理</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="__PUBLIC__/admin/favicon.ico">
    <link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/animate.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/js/plugins/fancybox/jquery.fancybox.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/js/plugins/iCheck/custom.css" rel="stylesheet">
    <!--<link href="__PUBLIC__/admin/js/layui/css/layui.css" rel="stylesheet">-->

</head>
<include file="Admin@Index:cache" />
<body class="gray-bg contacts">
<style>
    .table-hover>tbody>tr>td{
        height:4rem;
    }
</style>
<div class="wrapper wrapper-content animated fadeInRight" oncopy="copyval()">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox">
                <div class="ibox-content">
                    <h2>商户出借人列表</h2>

                    <!--<div class="input-group">-->
                    <!--<form type="get" enctype="multipart/form-data" action="__SELF__">-->
                    <!--<input type="text" placeholder="请输入手机号" name="content" id="content" class="input form-control">-->
                    <!--<div class="input-group-btn">-->
                    <!--<bottom style="height: 2.8rem;"  id="search" type="submit" class="btn btn btn-primary"><i class="fa fa-search"></i> 搜索</bottom>-->
                    <!--</div>-->
                    <!--</form>-->
                    <!--</div>-->
                    <div class="col-sm-12" style="margin-bottom: 1rem">
                        <form role="form" action="__SELF__" method="get">
                            <div class="form-group">
                                <!--<label>商品code</label>-->
                                <input type="text" id="content" placeholder="" name="content" class="form-control">
                            </div>
                            <div>
                                <a class="btn btn-success" style="margin-bottom: 3px" onclick="add_lender()">+添加出借人</a>
                                <button class="btn btn-sm btn-primary pull-right m-t-n-xs" type="submit" id="search"><strong>搜索</strong>
                                </button>

                            </div>
                        </form>
                    </div>
                    <br>
                    <table class="table table-striped table-hover">
                        <tbody>
                        <tr>
                            <th>出借人姓名</th>
                            <th>出借人手机号</th>
                            <th>出借人身份证号</th>
                            <th>签名</th>
                            <th>创建时间</th>
                            <th class="client-status">操作</th>

                        </tr>
                        <foreach name="list" item="list">
                            <tr>
                                <td><{$list.name}></td>
                                <td><{$list.mobile}></td>
                                <td>
                                    <{$list.idcard}>
                                </td>
                                <td><img style="height: 43px; width: 100px;" src="<{$list.signature}>" /></td>
                                <td><{$list.ctime}></td>

                                <td class="client-status">
                                    <a class="btn btn-danger btn-rounded" rid="<{$list.id}>" href="javascript:void(0);" onclick="del_lender('<{$list.idcard}>');" >删除</a>
                                    <!--<a class="btn btn-danger btn-rounded " href="javascript:void(0);" onclick="mark_reason('<{$list.repayment_no}>')" >备注</a>-->
                                </td>
                            </tr>
                        </foreach>
                        </tbody>
                    </table>
                    <ul class="pagination">

                        <{$fpage}>

                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__PUBLIC__/admin/js/layer/layer.js"></script>
<script src="__PUBLIC__/admin/js/layui/layui.js"></script>
<script src="__PUBLIC__/admin/js/layui/lay/modules/laydate.js"></script>
<!--<script src="__PUBLIC__/admin/js/layui/lay/dest/layui.all.js"></script>-->
<!-- 自定义js -->
<script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
<script src="__PUBLIC__/admin/js/plugins/fancybox/jquery.fancybox.js"></script>

<script src="__PUBLIC__/admin/chajian/jq-signature.js"></script>
<script src="__PUBLIC__/admin/chajian/WritingPad.js"></script>

<script>
    function add_lender(){
        var html='';
        html+='<div class="modal-body" id="lists" style="height:100%">';
        html+='<form class="form-horizontal">';
        html+='<div class="form-group">';
        html+='<label class="col-sm-3 control-label" >姓名：</label>';
        html+='<div class="col-sm-8">';
        html+='<input type="text" id="name" autocomplete="off" placeholder="姓名" class="form-control">';
        html+='</div>';
        html+='</div>';
        html+='<div class="form-group">';
        html+='<label class="col-sm-3 control-label" >手机号：</label>';
        html+='<div class="col-sm-8">';
        html+='<input type="number" id="mobile" autocomplete="off" placeholder="手机号" class="form-control">';
        html+='</div>';
        html+='</div>';
        html+='<div class="form-group">';
        html+='<label class="col-sm-3 control-label" >身份证号：</label>';
        html+='<div class="col-sm-8">';
        html+='<input type="text" id="idcard" autocomplete="off" placeholder="身份证号" class="form-control">';
        html+='</div>';
        html+='</div>';
        html+='<div class="form-group">';
        html+='<label class="col-sm-3 control-label">签名：</label>';
        html+='<div class="col-sm-9" style="width: 67%;" id="qianming">';
        html+='</div>';
        html+='</div>';
        html+='</form>';
        html+='<div class="modal-footer" style="border:0">';
        html+='<a href="javascript:void(0);" onclick="layer.closeAll()" type="button" class="btn btn-default" >关闭</a>';
        html+='<a href="javascript:void(0);" onclick="add_lenders();" type="button" class="btn btn-primary" >提交</a>';
        html+='</div>';
        html+='</div>';

        layer.open({
            type: 1, //Page层类型
            area: ['600px', '700px'],
            title: '添加出借人',
            shade: 0.6, //遮罩透明度
            maxmin: true, //允许全屏最小化
            anim: 1, //0-6的动画形式，-1不开启
            content: html
        });
        new WritingPad();
    }


    function add_lenders(){
        layer.confirm('是否确定添加出借人？',function(){
            layer.load(2);
            $.post('__MODULE__/Voucher/add_lender',{
                name:$('#name').val(),
                mobile:$('#mobile').val(),
                idcard:$('#idcard').val(),
                signature:$('#signature_img').attr('src')
            },function(data){
                layer.closeAll('loading');
                if(data.code=='1001'){
                    layer.closeAll();
                    layer.msg(data.result,{icon: 1,time:1000}, function(){
                        window.location.reload();
                    });
                }else{
                    if(data.status=='0'){
                        layer.msg(data.info,{time:2000,icon:5});
                    }else{
                        layer.msg(data.result,{time:2000,icon:5});
                    }
                }
            })
        });
    }


    //删除
    function del_lender(idcard){
        layer.confirm('是否确定删除该出借人',function(){
            layer.load(2);
            $.post('__MODULE__/Voucher/del_lender',{idcard:idcard},function(data){
                layer.closeAll();
                if(data.code=='1001'){
                    layer.closeAll();
                    layer.msg(data.result,{icon: 1,time:1000}, function(){
                        window.location.reload();
                    });
                }else{
                    if(data.status=='0'){
                        layer.msg(data.info,{time:2000,icon:5});
                    }else{
                        layer.msg(data.result,{time:2000,icon:5});
                    }
                }
            });
        });
    }


    function copyval() {
//        event.returnValue = false;
        var content = window.getSelection().toString();
        $.post('__MODULE__/Mypublic/copy_all', {content:'【出借人管理】复制：'+content}, function (data) {
            if (data.code == '1001') {
            } else {
                console.log(data);
            }
        });
//        console.log(content)
    }
</script>


</body>

</html>
